package com.data.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: wangmq
 * @create: 2024-01-09 16:07
 **/
public class RedisTemplate {

    private static Map map = new HashMap<>();

    private static final int MAP_MAX_SIZE = 16;

    public static synchronized <T> void put(String key, T value){
        if(map.keySet().size()>MAP_MAX_SIZE){
            throw new RuntimeException("out of map size");
        }
        map.put(key, value);
    }

    public static <T> T get(String key){
        return (T) map.get(key);
    }

    public static synchronized void remove(String key){
        map.remove(key);
    }

}
